package com.swt.junitTest;

import java.util.List;
import org.junit.Before;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.swt.pojo.Address;
import com.swt.service.address.AddressService;

public class Test {
	
	private AddressService addressService;
	private ApplicationContext applicationContext;
	
	@Before
	public void init(){
		applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
		addressService = (AddressService) applicationContext.getBean("addressService");
	}

	@org.junit.Test
	public void selectByPrimaryKey() {
		Address address = addressService.selectByPrimaryKey(1);
		System.out.println(address);
	}
	
	@org.junit.Test
	public void selectAddressList(){
		Address address = new Address();
		address.setParentid(11);
		address.setPage(1);
		address.setRows(5);
		List<Address> list = addressService.selectAddressList(address);
		for(Address address2:list){
			System.out.println(address2);
		}
	}

}
